import type { FC } from "react";
import { Button,Popconfirm} from 'antd';
import { resetAllStore } from "@/store/resetter";
import { useNavigate } from "react-router-dom";


const LogOut:FC =() =>{
    const navigate = useNavigate()
    const confirm = () => {
       //1.清空store中的数据
       resetAllStore()
       //2.跳转登陆页面
       navigate('login')
      };

    return(<>
        {/* 退出按钮 */}
        <Popconfirm
    title="退出登录"
    description="确认要退出登录吗?"
    onConfirm={confirm}
    okText="Yes"
    cancelText="No"
  >
    <Button type="link">退出</Button>
  </Popconfirm>
    </>)
}


export default LogOut